<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="app">
    <div v-mymodel></div>
  </div>
  <script>
    // 创建插件
    let MyPlugin = {
      install(Vue, options) {
        Vue.myStaticFun = () => {
          console.log('this is Vue Static Fun');
        }
        Vue.directive('mymodel', {
          bind() {
            console.log('this is directive bind');
          }
        })
        Vue.prototype.$myFun = () => {
          console.log('this is vue proto fun');
        }
      }
    }
    // 使用插件，在创建vue实例之前
    // 保证创建出来的vue实例能够访问插件中的全局方法或属性
    Vue.use(MyPlugin)

    let vm = new Vue({
      el: "#app",
      data: {

      },
      methods: {

      },
      created() {

      }
    })
  </script>
</body>

</html>